//
//  SelectContentCell.m
//  Shengzhuli
//
//  Created by FXGuo on 17/3/29.
//  Copyright © 2017年 kamangkeji. All rights reserved.
//

#import "SelectContentCell.h"

@interface SelectContentCell()
@property (weak, nonatomic) IBOutlet UILabel *nameLab;
@property (weak, nonatomic) IBOutlet UIButton *selectBtn;



@end

@implementation SelectContentCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)selectBtnClick:(UIButton *)btn
{
    btn.selected = !btn.selected;
    self.model.isSelect = btn.isSelected;
    SourceModel *parentModel = self.model.parentModel;
    if (btn.isSelected) {
        [parentModel.selectIds addObject:@(self.model.ID)];
        [parentModel.selectIdNames addObject:self.model.industryName];
    }else{
        [parentModel.selectIds removeObject:@(self.model.ID)];
        [parentModel.selectIdNames removeObject:self.model.industryName];
    }
    if (self.btnSelectBlock) {
        self.btnSelectBlock();
    }
}

- (void)setModel:(SourceModel *)model
{
    _model = model;
    self.nameLab.text = model.industryName;
    self.selectBtn.selected = model.isSelect;
}

@end
